package com.lct.d1_ploymorphism;

public class Test {
	public static void main(String[] args) {
		//多态的要求：继承、方法重写
		//1.对象多态
		Animal a1 = new Cat();
		a1.cry(); //方法有多态性，编译看左边，运行看右边
		System.out.println(a1.name); //变量没有多态

		Animal a2 = new Dog();
		a2.cry(); //编译看左边，运行看右边
		System.out.println(a2.name);

	}
}
